<template>
  <el-select v-model="currentValue" v-bind="$attrs" @change="onChange" style="width: 100%">
    <el-option v-for="user in users" :key="user.Userid" :value="user.Userid" :label="user.Realname + `(${user.Userid})`"></el-option>
  </el-select>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
  props: {
    value: {
      type: [String, Number],
      default: ''
    }
  },
  computed: {
    ...mapGetters(['users']),
    currentValue: {
      get () {
        return this.value;
      },
      set (val) {
        this.$emit('input', val);
      }
    }
  },
  methods: {
    onChange (val) {
      this.currentValue = val;
      this.$emit('change', val);
    }
  }
}
</script>
